Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuffz+ #4

Merged
merged 9 commits into from
Feb 7, 2014
Merged

Stuffz+ #4

merged 9 commits into from
Feb 7, 2014

Conversation

ribasushi
Copy link
Contributor

This is an alternative implementation to stuffz (#2). Everything said in #2 (comment) applies, with the difference being how we obtain the Cwd:

$ git diff gh/stuffz gh/stuffz+

diff --git a/lib/Test/DiagINC.pm b/lib/Test/DiagINC.pm
index ef31c4d..ecaf3f3 100644
--- a/lib/Test/DiagINC.pm
+++ b/lib/Test/DiagINC.pm
@@ -19,23 +19,15 @@ sub _max_length {
     return $max;
 }

-# Get our CWD *without* loading anything. The original idea by xdg++ was to
-# invoke a with an -e snippet, and not worry about quoting, but it seemed too
-# fragile. doing this trick instead (we know we can load ourselves):
-BEGIN {
-    if ($^C) {
-        require Cwd;
-        require POSIX;
-        $|++;
-        print Cwd::getcwd() . "\n";
-        POSIX::_exit(0);
-    }
-}
-chomp( my $REALPATH_CWD = do {
-  local $ENV{PATH};
-  my ($perl) = $^X =~ /(.+)/; # $^X is internal how could it be tainted?!
-  `$perl -c @{[ __FILE__ ]}`;
-});
+# Get our CWD *without* loading anything. Original idea by xdg++
+# ribasushi thinks this is fragile and will break sooner rather than
+# later, but adding it as is because haarg and xdg both claim it's fine
+my $REALPATH_CWD = do {
+    local $ENV{PATH};
+    my ($perl) = $^X =~ /(.+)/; # $^X is internal how could it be tainted?!
+    `$perl -MCwd -e print+getcwd`;
+};
+
 my $ORIGINAL_PID = $$;

 END {

@ribasushi ribasushi mentioned this pull request Feb 7, 2014
@dagolden dagolden merged commit d33e73e into dagolden:master Feb 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants